package com.uam.web.controller.recordset;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.uam.common.annotation.Log;
import com.uam.common.core.controller.BaseController;
import com.uam.common.core.domain.AjaxResult;
import com.uam.common.enums.BusinessType;
import com.uam.recordset.domain.TWrjzc;
import com.uam.recordset.service.ITWrjzcService;
import com.uam.common.utils.poi.ExcelUtil;
import com.uam.common.core.page.TableDataInfo;

/**
 * 无人机注册管理Controller
 * 
 * @author uam
 * @date 2025-09-10
 */
@RestController
@RequestMapping("/recordset/wrjzc")
public class TWrjzcController extends BaseController
{
    @Autowired
    private ITWrjzcService tWrjzcService;

    /**
     * 查询无人机注册管理列表
     */
    @PreAuthorize("@ss.hasPermi('recordset:wrjzc:list')")
    @GetMapping("/list")
    public TableDataInfo list(TWrjzc tWrjzc)
    {
        startPage();
        List<TWrjzc> list = tWrjzcService.selectTWrjzcList(tWrjzc);
        return getDataTable(list);
    }

    /**
     * 导出无人机注册管理列表
     */
    @PreAuthorize("@ss.hasPermi('recordset:wrjzc:export')")
    @Log(title = "无人机注册管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TWrjzc tWrjzc)
    {
        List<TWrjzc> list = tWrjzcService.selectTWrjzcList(tWrjzc);
        ExcelUtil<TWrjzc> util = new ExcelUtil<TWrjzc>(TWrjzc.class);
        util.exportExcel(response, list, "无人机注册管理数据");
    }

    /**
     * 获取无人机注册管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('recordset:wrjzc:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(tWrjzcService.selectTWrjzcById(id));
    }

    /**
     * 新增无人机注册管理
     */
    @PreAuthorize("@ss.hasPermi('recordset:wrjzc:add')")
    @Log(title = "无人机注册管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TWrjzc tWrjzc)
    {
        return toAjax(tWrjzcService.insertTWrjzc(tWrjzc));
    }

    /**
     * 修改无人机注册管理
     */
    @PreAuthorize("@ss.hasPermi('recordset:wrjzc:edit')")
    @Log(title = "无人机注册管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TWrjzc tWrjzc)
    {
        return toAjax(tWrjzcService.updateTWrjzc(tWrjzc));
    }

    /**
     * 删除无人机注册管理
     */
    @PreAuthorize("@ss.hasPermi('recordset:wrjzc:remove')")
    @Log(title = "无人机注册管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tWrjzcService.deleteTWrjzcByIds(ids));
    }
}
